function resortReverse(arr){
    if(arr){
        arr.sort();
        arr.reverse();
    }
}
let arr = [1,2,3,66,45,23]
resortReverse(arr);
console.log(arr);

function addQueryStringArg(url, name, value) { 
    if (url.indexOf("?") == -1){ 
    url += "?"; 
    } else { 
    url += "&"; 
    } 
    url += `${encodeURIComponent(name)}=${encodeURIComponent(value)}`; 
    return url; 
   }
const url = "http://www.somedomain.com"; 
const newUrl = addQueryStringArg(url, "redir", 
 "http://www.someotherdomain.com?a=b&c=d"); 
console.log(newUrl);